package xin.marcher.module.common.enums.quality;

import java.util.HashMap;
import java.util.Map;

/**
 * 调查池记录认领状态枚举
 */
public enum ClaimedStatusEnum {
    /**
     * 0-待认领
     */
    SHELTERS(0, "待认领"),

    /**
     * 1-已认领
     */
    CLAIMED(1, "已认领"),

    /**
     * 2-已结束
     */
    FINISHED(2, "已结束");

    private Integer code;

    private String value;

    ClaimedStatusEnum(Integer code, String value) {
        this.code = code;
        this.value = value;
    }

    public Integer getCode() {
        return code;
    }

    public String getValue() {
        return value;
    }

    public static Map<Integer, String> toMap() {
        Map<Integer, String> map = new HashMap<>(16);
        for (ClaimedStatusEnum element : ClaimedStatusEnum.values()) {
            map.put(element.getCode(), element.getValue());
        }
        return map;
    }

    public static ClaimedStatusEnum getByCode(Integer code) {
        if (code == null) {
            return null;
        }
        for (ClaimedStatusEnum element : ClaimedStatusEnum.values()) {
            if (code.equals(element.getCode())) {
                return element;
            }
        }
        return null;
    }
}
